import { useState } from 'react'
import './index.less'
import { Checkbox, Button } from 'antd';

export default (props) => {
    const { name,id ,done} = props
    const handleDelete = id =>{
        // console.log(id);
        props.deleteTodo(id)
    }

    const onChange = id => {
        // console.log(id);
        // console.log(done);
        props.updateTodo(id,done)
    }
    return (
        <div className = 'todo_item'>
                <Checkbox checked={done} onChange={() => onChange(id)}>{name}</Checkbox>
                <Button onClick = {() => handleDelete(id)} type="primary" danger shape='round' size='small'>删除</Button>
        </div>

    )
}